import os
from entiys.plugins.Loader import PluginLoader
from console_conpent.select import select
from game.TopClass.windows import Windows
from game_control.GameStartManager import GameStartManager
from game.setPlugins import SetPlugins


class StartGame(Windows):
    def UiShow(self):
        os.system("title 奴隶岛")

        PluginLoader.LOADER() # 加载插件

        policys = [
            GameStartManager.NewGame,
            GameStartManager.Continue,
            lambda : SetPlugins(lastWindows=self).UiShow(),
            GameStartManager.Exit
        ]

        selectHandler = select(
            title="奴隶岛 V1.0",
            options=["开始新游戏", "继续游戏", "命令行模式", "退出"],
            tips=["开始新的存档吧!", "回到之前的存档", "输入作弊码", "退出"]
        )
        selectHandler.show()
        code = selectHandler.getindex()
        policys[code]()
